{extend name="common/layout" /}
{block name="head"}
<style type="text/css">
    .network-info .label{color: #999;padding:20px;}
    .table-input{height: 28px;line-height: 28px;width: 200px;display: inline-block;}
    .text-apsn{color: #999;}
</style>
{/block}
{block name="main"}
<div class="admin-main layui-anim layui-anim-upbit">

    <fieldset class="layui-elem-field layui-field-title">
        <legend>{:lang('Network Line')}</legend>
    </fieldset>
   
  <div class="layui-form">
    <div class="layui-row">
      <div <?php if(!empty($user)): ?> class="layui-col-xs6" <?php endif;?>>
      <table class="layui-table network-info" style="width: 99%;">
        <thead>
          <tr>
            <th style="border-left: 5px solid #009688;" colspan="2">{:lang('Basic Information')}</th>
          </tr> 
        </thead>
        <tbody>
          <tr>
            <td style="width: 200px;"><label class="label">{:lang('Customer No.')}：</label></td>
            <td>
            {$row['sn']|default="--"}　
          <?php if($adminType == 4 || $adminType == 1):?>
            <a href="javascript:;" style="color: #72a4fd;" id="_resetsn" data-href="{:U('resetsn',array('network_id'=>$row['id']))}">{:lang('Reset')}</a>
          <?php endif?>
          </td>
          </tr>
          <tr>
            <td><label class="label">{:lang('Network Name')}：</label></td>
            <td>{$row['name']}</td>
          </tr>
         
          <tr>
            <td><label class="label">{:lang('Local Access Type')}：</label></td>
            <td>{$row['typelabel']}</td>
          </tr>
          <tr>
            <td><label class="label">{:lang('Bandwidth')}：</label></td>
           <td>{$row['broadband']} (Mbs)
            <?php if($row['status'] == 8 && $row['broadband'] < $row['mbs']):?>
              <i class="icon icon-move-up" style="color: #07ac68;font-size: 18px;"></i> {$row['mbs']} (Mbs)
            <?php endif;?>
            <?php if($row['status'] == 8 && $row['broadband'] > $row['mbs']):?>
              <i class="icon icon-move-down" style="color: #07ac68;font-size: 18px;"></i> {$row['mbs']} (Mbs)
            <?php endif;?>
           </td>
          </tr>
          <tr>
            <td><label class="label">{:lang('Monthly rental fee')}：</label></td>
            <td>{$row['total']} / {:lang('Month')}</td>
          </tr>
          <!--計劃開通時間-->
          <?php if(!empty($row['plan_time'])):?>
          <tr>
            <td><label class="label">{:lang('Planned opening time')}：</label></td>
            <td>{$row['plan_time']}</td>
          </tr>
          <?php endif;?>
          <tr>
            <td><label class="label">{:lang('Opening Date')}：</label></td>
            <td>
              <input type="text" name="appro_time" id="_approtime" data-type="{$adminType == 4 ? 1 :0}" class='layui-input table-input display-input _noajax' data-url="{:U('ajax/updateField',['nework_id'=>$row['id']])}" disabled value="{$row['approtime']|default="--"}">

            </td>
          </tr>
          
          <tr>
            <td><label class="label">{:lang('Expire Date')}：</label></td>
            <td>
               <input type="text" name="enddate" id="_enddate" data-type="{$adminType == 4 ? 1 :0}" class='layui-input table-input display-input _noajax' data-url="{:U('ajax/updateField',['nework_id'=>$row['id']])}" disabled value="{$row['enddate']|default="--"}">
            </td>
          </tr>
          <tr>
            <td><label class="label">{:lang('Status')}：</label></td>
            <td>
              <?php if($adminType == 4):?>
              <select name="status" lay-filter="_status" id="_status" class="display-change">
                <option value="{$row['status']}" selected disabled="">{$statuslist[$row['status']]}</option>
                <?php foreach($statuslist as $in=>$status):?>
                <?php if(($in == 15 || $in==16) && $in != $row['status']):?>
                <option value="{$in}" >{$status}</option>
                <?php endif;?>
                <?php endforeach;?>
              </select>
              <?php else:?>
              {$row['statuslabel']}
              <?php endif;?>
            </td>
          </tr>
          <?php if($adminType == 4):?>
            <tr>
            <td><label class="label">{:lang('Media')}：</label></td>
            <td >
              <div style="position: relative;width: 70%">
                <input type="text" name="media" placeholder="" value="{$row['media']}" style="" lay-verify="required" id="_media" class="layui-input" readonly="" >
                <button type="button" class="layui-btn layui-btn-primary" id="_mediaBtn" style="position: absolute;right: -80px;top:0"><i class="icon icon-upload3"></i>{:lang('Upload Image')}</button>
                <p id="_media_view"><img src="{$row['media']}" id="_image-full" style="width: 80px;max-height: 80px;cursor:pointer;" /></p>
              </div>
              
            </td>
          </tr>
          <?php else:?>
          <?php if(!empty($row['media']) ):?>
          <tr>
            <td><label class="label">{:lang('Media')}：</label></td>
            <td>
              <img src="{$row['media']}" id="_image-full" style="width: 80px;max-height: 80px;cursor:pointer;" />
            </td>
          </tr>
          <?php endif;?>
          <?php endif;?>
          <tr>
            <td><label class="label">{:lang('remarks')}：</label></td>
            <td>{$row['remarks']|default='--'}</td>
          </tr>
          
        </tbody>
      </table>
  </div>
  <?php if(!empty($user)):?>
  <!--用户信息-->
  <div class="layui-col-xs6">
    <table class="layui-table network-info" >
        
        <thead>
          <tr>
            <th style="border-left: 5px solid #009688;" colspan="2">{:lang('User Data')}</th>
          </tr> 
        </thead>
        <tbody>
          <tr>
            <td style="width: 200px;"><label class="label">{:lang('User Mailbox')}</label></td>
            <td>
            {$user['email']}
          </td>
          </tr>
          <tr>
            <td><label class="label">{:lang('User Ownership')}：</label></td>
            <td>{$user['sup_id']|getSupNameGroup}</td>
          </tr>
           <tr>
            <td><label class="label">{:lang('tel')}：</label></td>
            <td>{$user['tel']|default="--"}</td>
          </tr>
          <tr>
            <td><label class="label">{:lang('Telephone')}：</label></td>
            <td>{$user['Telephone']|default="--"}</td>
          </tr>
          <tr>
            <td><label class="label">{:lang('Company Name')}：</label></td>
           <td>{$user['company']|default="--"}
           
           </td>
          </tr>
         
          
          <tr>
            <td><label class="label">{:lang('Company Address')}：</label></td>
            <td>{$user['address']|default="--"}</td>
          </tr>
          <tr>
            <td><label class="label">{:lang('Position')}：</label></td>
            <td>{$user['position']|default="--"}</td>
          </tr>
        </tbody>
      </table>
  </div>
<?php endif;?>
</div>
<div class="layui-row">
  <div class="layui-col-xs6">
  <table class="layui-table network-info" style="width: 99%;">
    
    <thead>
      <tr>
        <th style="border-left: 5px solid #009688;" colspan="2">{:lang('Local Information')}</th>
      </tr> 
    </thead>
    <tr>
      <td style="width: 200px;"><label class="label">{:lang('Local Access')}：</label></td>
      <td>{$row['locallabel']}</td>
    </tr>
    <tr>
      <td style="width: 200px;"><label class="label">{:lang('Local Access Area')}：</label></td>
      <td>{$row['locatlabeladdress']}</td>
    </tr>
    <?php if($row['type'] == 3):?>
      <tr>
      <td style="width: 200px;"><label class="label">{:lang('Data Center')}：</label></td>
      <td>{$row['cloud_conter']|getDataCenter}</td>
    </tr>
      <tr>
        <td style="width: 200px;"><label class="label">
        <?php if($row['local_cloud_id'] == 3739):?>
            {:lang('Pairing key')}：
        <?php elseif($row['local_cloud_id'] == 3738):?>
            {:lang('Service Key')}： 
        <?php elseif($row['local_cloud_id'] == 3742):?>
            {:lang('Account')}：
        <?php else:?>
            {:lang('Account ID')}：
        <?php endif;?>
      </label></td>
       <td>{$row['local_cloud_userid']} 
        <!-- <?php if(isAWS($row['local_cloud_id']) && $adminType == 1):?>
          <button class="layui-btn layui-btn-primary layui-btn-sm show-password" data-aid="1" >{:lang('查看AccessID&SecrectKey')}</button>
        <?php endif;?> -->
       </td>
      </tr>
      <!--华为云-->
      <?php if($row['local_cloud_id'] == 3742):?>
      <tr>
        <td><label class="label">{:lang('Order ON.')}</label></td>
        <td>{$row['orderId1']}</td>
      </tr>
      <tr>
        <td><label class="label">{:lang('VPC ID')}</label></td>
        <td>{$row['VPCID1']}</td>
      </tr>
      <tr>
        <td><label class="label">{:lang('VPC')}</label></td>
        <td>{$row['VPC1']}</td>
      </tr>
      <?php endif;?>
      <!--end 华为云-->
      <!-- <?php if(isAWS($row['local_cloud_id'])):?>
      <tr>
        <td><label class="label">{:lang('AccessID')}：</label></td>
        <td><span class="access_id_1">********</span></td>
      </tr>
      <tr>
        <td><label class="label">{:lang('SecrectKey')}：</label></td>
        <td>
            <span class="secrect_key_1">********</span>
        </td>
      </tr>
      <?php endif;?> -->
    <?php else:?>
      
    <?php endif;?>
    <tr>
      <td><label class="label">{:lang('End Network')}：</label></td>
     <td>
<input type="text" name="local_network"  data-type="{$adminType == 5 ? 1 :0}" class='layui-input table-input display-input' data-url="{:U('ajax/updateField',['nework_id'=>$row['id']])}" disabled value="{$row['local_network']|default="--"}">
     </td>
    </tr>
  </table>
</div>
<div class="layui-col-xs6">
  <!--对端信息-->
  <table class="layui-table network-info">
    
    <thead>
      <tr>
        <th style="border-left: 5px solid #009688;" colspan="2">{:lang('Peer Information')}</th>
      </tr> 
    </thead>
    <tbody>
       <tr>
        <td style="width: 200px;"><label class="label">{:lang('Peer Access')}：</label></td>
        <td>{$row['endclou']}</td>
      </tr>
      <tr>
        <td style="width: 200px;"><label class="label">{:lang('Peer Access Area')}：</label></td>
        <td>{$row['endlabeladdress']}</td>
      </tr>
      <?php if($row['endtype'] == 3):?>
        <tr>
          <td style="width: 200px;"><label class="label">{:lang('Data Center')}：</label></td>
          <td>{$row['ecloud_conter']|getDataCenter}</td>
        </tr>
        <tr>
          <td><label class="label">
          <?php if($row['endcloudid'] == 3739):?>
              {:lang('Pairing key')}：
          <?php elseif($row['endcloudid'] == 3738):?>
              {:lang('Service Key')}： 
          <?php elseif($row['endcloudid'] == 3742):?>
              {:lang('Account')}：
          <?php else:?>
              {:lang('Account ID')}：
          <?php endif;?>
          </label></td>
         <td>{$row['end_userid']}
         <!--  <?php if(isAWS($row['endcloudid']) && $adminType == 1):?>
            <button class="layui-btn layui-btn-primary layui-btn-sm show-password" data-aid="2" >{:lang('查看AccessID&SecrectKey')}</button>
          <?php endif;?> -->
         </td>
        </tr>
        <!--华为云-->
        <?php if($row['endcloudid'] == 3742):?>
        <tr>
          <td><label class="label">{:lang('Order ON.')}</label></td>
          <td>{$row['orderId2']}</td>
        </tr>
        <tr>
          <td><label class="label">{:lang('VPC ID')}</label></td>
          <td>{$row['VPCID2']}</td>
        </tr>
        <tr>
          <td><label class="label">{:lang('VPC')}</label></td>
          <td>{$row['VPC2']}</td>
        </tr>
        <?php endif;?>  
      <?php endif;?>  
        <tr>
        <td><label class="label">{:lang('End-to-end Network')}：</label></td>
        <td><input type="text" name="end_network" data-type="{$adminType == 5 ? 1 :0}" class='layui-input table-input display-input' data-url="{:U('ajax/updateField',['nework_id'=>$row['id']])}" disabled value="{$row['end_network']|default="--"}"></td>
      </tr>
    </tbody>
  </table>
  </div>
</div>
  
  <!--管理员配置-->
  <!--对端信息-->
  <?php if($adminType == 1 || $adminType == 5):?>
  <form class="layui-form" action="{:U('saveConfig')}" id="_saveForm">
    <input name="network_id" type="hidden" value="{$row['id']}" />
  <table class="layui-table network-info">
    <thead>
      <tr>
        <th style="border-left: 5px solid #009688;" colspan="2">
          {:lang('Cloud end butt')}
         
        </th>
        <th style="" colspan="2">
          {:lang('Client docking')}
          <button style="float: right;" lay-submit="" lay-filter="submit" class="layui-btn layui-btn-xs" title="{:lang('Save')}"><i class="icon icon-floppy-disk"></i></button>
        </th>
      </tr> 
    </thead>
    <tbody>
      
      <tr>
        <td style="width: 220px;"><label class="label">{:lang('Vlan (Outer)')}：</label></td>
        <td>
          <input type="text" name="vlan_cloud" class="layui-input table-input" placeholder="" value="{$config['vlan_cloud']}" />
        </td>
        <td style="width: 220px;"><label class="label">{:lang('Vlan (Outer)')}：</label></td>
        <td><input type="text" value="{$config['vlan_idc']}" name="vlan_idc" class="layui-input table-input" placeholder=""/>
        </td>
      </tr>
      <tr>
        <td style="width: 220px;"><label class="label">{:lang('Vlan (Inner)')}：</label></td>
        <td>
          <input type="text" name="vlan_cloud_inner" class="layui-input table-input" placeholder="" value="{$config['vlan_cloud_inner']}" />
        </td>
        <td style="width: 220px;"><label class="label">{:lang('Vlan (Inner)')}：</label></td>
        <td><input type="text" value="{$config['vlan_idc_inner']}" name="vlan_idc_inner" class="layui-input table-input" placeholder=""/>
        </td>
      </tr>
      <tr>
        <td><label class="label">{:lang('Backbone Boundary IP')}：</label></td>
        <td><input type="text" value="{$config['backboundary_ip']}" name="backboundary_ip" class="layui-input table-input" placeholder="0.0.0.0/0" /></td>
        <td style="width: 200px;"><label class="label">{:lang('Backbone Boundary IP')}：</label></td>
        <td><input type="text" name="back_idc" value="{$config['back_idc']}" class="layui-input table-input" placeholder="0.0.0.0/0"/></td>
      </tr>
      <tr>
        <td style="width: 200px;"><label class="label">{:lang('Cloud Boundary IP')}：</label></td>
        <td><input type="text" value="{$config['boundary_ip']}"  name="boundary_ip" class="layui-input table-input" placeholder="0.0.0.0/0"/></td>
        <td style="width: 200px;"><label class="label">{:lang('IDC Boundary IP')}：</label></td>
        <td><input type="text" value="{$config['idc_ip']}" name="idc_ip" class="layui-input table-input" placeholder="0.0.0.0/0"/></td>
      </tr>
      <tr>
        <td><label class="label">{:lang('Backbone ASN')}：</label></td>
        <td><input type="text" value="{$config['back_asn']}" name="back_asn" class="layui-input table-input" placeholder=""/></td>
        <td><label class="label">{:lang('Backbone ASN')}：</label></td>
        <td><input type="text" value="{$config['asn_idc']}" name="asn_idc" class="layui-input table-input" placeholder=""/></td>
      </tr>
      
      <tr>
        <td><label class="label">{:lang('Cloud ASN')}：</label></td>
        <td><span class=""><input value="{$config['cloud_asn']}" name="cloud_asn" type="text" class="layui-input table-input" placeholder=""/></span></td>
        <td><label class="label">{:lang('IDC ASN')}：</label></td>
        <td colspan="1"><input value="{$config['idcasn']}" name="idcasn" type="text" class="layui-input table-input" placeholder=""/>  </td>
      </tr>
      
    </tbody>
  </table>
  </form>
  <?php endif;?>
  <?php if($adminType == 1 || $adminType == 4):?>
  <table class="layui-table">
    
    <thead>
      <tr>
        <th>{:lang('Engineer')}</th>
        <th>{:lang('Type')}</th>
        <th>{:lang('Distribution Time')}</th>
        <th>{:lang('Feedback Content')}</th>
        
        <th>{:lang('Feedback Time')}</th>
        <th></th>
      </tr> 
    </thead>
    <tbody>
      <?php if($backeens):?>
        <?php foreach($backeens as $ed):?>
      <tr>
        <td>{$ed['username']}</td>
        <td>{$ed['state']==8?lang('Line Adjustment'):lang('Open')}</td>
        <td>{$ed['create_time']|date="Y-m-d H:i",###}</td>
        <td>{$ed['content']|default="--"}</td>

        <td>{:empty($ed['update_time']) ? '--' : date('Y-m-d H:i',$ed['update_time'])}</td>
        
        <td align="right">
          <?php if($ed['is_update'] == 1):?>
              <button class="layui-btn layui-btn-normal layui-btn-disabled" disabled="true" >{:lang('Change')}</button>
          <?php else:?>
              <button class="layui-btn layui-btn-normal fenpeiex" data-href="{:U('ajax/updateEng',array('id'=>$ed['id']))}">{:lang('Change')}</button>
          <?php endif;?>
        </td>
      </tr>
      <?php endforeach;?>
    <?php else: ?>
       <tr>
        <td colspan="6" align="center">{:lang('No Data...')}</td>
      </tr>
    <?php endif;?>
     
    </tbody>
  </table>
<?php endif;?>
</div>
<div style="text-align: center;">
<?php if($adminType == 10000):?>
  <?php if($row['status'] == 1):?>
      <a href="{:url('edit',array('network_id'=>$row['id']))}"  class="layui-btn">{:lang('Rewrite')}</a>
  <?php endif;?>
<?php elseif($adminType == 1):?>
  <?php if(($row['status'] == 1 || $row['status'] == 8)):?>
      <?php if($engStatus == 0 || $engStatus == 3):?>
        <button class="layui-btn layui-btn-normal fenpeiex" data-href="{:U('ajax/fenpei',array('nework_id'=>$row['id']))}">{:lang('Distribution Engineer')}</button>
        <button class="layui-btn layui-btn-warm backtask" data-href="{:U('_backtask')}">{:lang('Return')}</button>
       <?php endif;?> 
       
      <?php if($engStatus == 2):?>
        <button class="layui-btn admin_agree" data-title="{:lang('Confirm whether route configuration is approved.')}" data-href="{:U('_confirm',array('nework_id'=>$row['id']))}">{:lang('Finish')}</button>
        <!-- <button class="layui-btn layui-btn-normal fenpeiex" data-href="{:U('ajax/fenpei',array('nework_id'=>$row['id']))}">{:lang('Distribution Engineer')}</button> -->
      <?php endif;?>
    
  <?php endif;?>
  <?php if($row['status'] == 10):?>
   <button class="layui-btn confirm-del" data-href="{:U('confirmdel',array('nework_id'=>$row['id']))}">{:lang('Agree Delete')}</button>
   <button class="layui-btn layui-btn-warm backtask" data-href="{:U('_backdel')}">{:lang('Return')}</button>
  <?php endif;?>
  <!--工程师-->
<?php elseif($adminType == 5):?>
    <?php if($checkEngHasPsiee):?>
    <button class="layui-btn layui-btn-normal _agree"  data-title="{:lang('Please enter Remarks')}" data-href="{:U('ajax/kaitong',array('network_id'=>$row['id'],'eng_id'=>$checkEngHasPsiee))}">{:lang('Configuration Finish')}</button>
    <button class="layui-btn layui-btn-warm rebackcontent" data-href="{:U('ajax/rebackcontent',array('network_id'=>$row['id'],'status'=>3))}">{:lang('Return')}</button>
   <?php endif;?>
<?php endif;?>
</div>
</div>
{/block}
{block name="footer"}
<!--分配工程师-->
<script type="text/javascript" id="fenpeiex_from">
    <form class="layui-form" id="engine_form" action="{:U('_confirm')}">
        <input type="hidden" value="{$row['id']}" name="network_id"/>
        <div class="layui-form-item" style="margin-top:25px;padding:0 20px;">
            <div class="layui-input-12">
              <select name="enginee_id" lay-filter="aiha2o">
                <option value="0">{:lang('Select Engineer')}</option>
                <?php if(is_array($enginees)):?>
                    <?php foreach($enginees as $eng):?>
                        <option value="{$eng['admin_id']}">{$eng['email']}【{$eng['username']}】</option>
                    <?php endforeach;?>
                <?php endif;?>
              </select>
            </div>
        </div>
    </form>
</script>
<!--工程师反馈-->
<script type="text/javascript" id="reback_from_html">
    <form id="reback_forms" action="{:U('ajax/rebackcontent')}">
        <input type="hidden" value="{$checkEngHasPsiee}" name="id"/>
        <input type="hidden" value="{$row['id']}" name="network_id"/>
        <div class="layui-form-item" style="margin-top:25px;padding:0 20px;">
            <div class="layui-input-12">
              <textarea style="min-heigth:80px;" placeholder="{:lang('Please enter the return reasons')}" class="layui-textarea" name="content"></textarea>
            </div>
        </div>
    </form>
</script>
<!--退回需求-->
<script type="text/javascript" id="backtask_from">
    <form class="layui-form" id="_form" action="{:U('_backtask')}">
        <input type="hidden" value="{$row['id']}" name="nework_id"/>
        <div class="layui-form-item" style="margin-top:25px;padding:0 20px;">
           <textarea style="min-heigth:80px;" placeholder="{:lang('Please enter the return reasons')}" class="layui-textarea" name="desc"></textarea>
        </div>
    </form>
</script>

<script type="text/javascript" id="enter-password">
    <form class="layui-form" id="password-form" action="">
        <input type="hidden" value="{$row['id']}" id="pasw_nework_id" name="nework_id"/>
        <div class="layui-form-item" style="margin-top:25px;padding:0 20px;">
           <input type="text" id="_password" name="password"  placeholder="{:lang('Please enter your login password.')}" class="layui-input">
        </div>
    </form>
</script>
   <script type="text/javascript">
    var nework_id = "{$row['id']}";
   	  layui.use(['form','layer','laydate','upload'], function(){
        
          var $ = layui.jquery, form = layui.form,layer = layui.layer,laydate = layui.laydate,upload = layui.upload; 

          //日期
          laydate.render({
              elem: '#_approtime',
              lang: 'en',
              done: function(value, date){
                actionFieldAjax($('#_approtime'));
              }
          });
          laydate.render({
              elem: '#_enddate',
              lang: 'en',
              done: function(value, date){
                actionFieldAjax($('#_enddate'));
              }
          });
          /*放大图片*/
          $('body').on("click","#_image-full",function(){
            var _this = $(this);
            layer.closeAll()
            layer.open({
              type: 1,
              title:false,
              content: '<img src="'+_this.attr('src')+'" style="max-width:700px;max-height:700px">' //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
            });
          })
          //普通图片上传
        var loading = null;
        var uploadInst = upload.render({
            elem: '#_mediaBtn'
            ,url: '{:url("api/upload/expand",array('network_id'=>$row['id']))}'
            ,data:{network_id:1}
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                loading =layer.load(1, {shade: [0.1,'#fff']});
            }
            ,done: function(res){
                layer.close(loading);  
                //上传成功
                if(res.code == 0){
                    $('#_media').val(res.url);
                    $('#_media').parent().find("#_media_view").remove();
                    $('#_media').parent().append('<p id="_media_view"><img src="'+res.url+'"style="width:100px;max-height:100px;margin-top:3px;" /></p>')
                }else{
                    //如果上传失败
                    return layer.msg("{:lang('Upload failure')}");
                }
            }
            ,error: function(){
                layer.close(loading);  
                //演示失败状态，并实现重传
                return layer.msg("{:lang('Upload failure')}");
            }
        });
          /*监听状态改变*/
          form.on('select(_status)', function(data){
            if(!confirm("{:lang('Confirm changed status?')}")){
               return false;
            }
             var loading = layer.load(1,{shade:[0.1,'#fff']});
              $.post("{:url('Ajax/updateField',['nework_id'=>$row['id']])}",{field:'status',value:data.value},function(res){
                  layer.close(loading);
                  if(res.code==1){
                    _this.attr('disabled',true);
                  }else{
                    layer.msg(res.msg, {time: 1800, icon: 2});
                  }
              })
          })
          /*工程师确认完成配置*/
          $("._agree").click(function(){
             var _this = $(this)
             var _confirm = layer.prompt({
              formType: 2,
              title: _this.data('title'),
              area: ['300px', '50px'],
              btn: "{:lang('Confirm')}",                
             },
             function(value, index, elem){
                var _form = $("#_form");
                loading = layer.load(1,{shade:[0.1,'#fff']});
                 $.post(_this.data('href'),{content:value},function(res){
                    layer.close(loading)
                    if(res.code == 1){
                       layer.msg(res.msg, {time: 1800, icon: 1},function(){
                        location.reload();
                      });
                    }else{
                        layer.msg(res.msg, {time: 1800, icon: 2});
                    }
                 })
             })
          });
          /*管理员确认开通*/
          $(".admin_agree").click(function(){
             var _this = $(this)
             var _confirm = layer.confirm(_this.data('title'),function(){
                var _form = $("#_form");
                loading = layer.load(1,{shade:[0.1,'#fff']});
                 $.post(_this.data('href'),{},function(res){
                    layer.close(loading)
                    if(res.code == 1){
                       layer.msg(res.msg, {time: 1800, icon: 1},function(){
                        location.reload();
                      });
                    }else{
                        layer.msg(res.msg, {time: 1800, icon: 2});
                    }
                 })
             })
          });
          form.on('submit(submit)', function (data) {
              loading = layer.load(1,{shade:[0.1,'#fff']});
              // 提交到方法 默认为本身
              //data.field.id = $scope.field.id;
              $.post($("#_saveForm").attr('action'), data.field, function (res) {
                  layer.close(loading);
                  if (res.code > 0) {
                      layer.msg(res.msg, {time: 1800, icon: 1}, function () {
                          //location.reload();
                      });
                  } else {
                      layer.msg(res.msg, {time: 1800, icon: 2});
                  }
              });
              return false;
          });
           /*需求退回*/
          $(".backtask").click(function(){
            var _this = $(this);
              layer.open({
              type: 1
              ,id: 'layerDemo2' //防止重复弹出
              ,title:"{:lang('Auditing')}"
              ,area: ['420px', '260px']
              ,content: $("#backtask_from").html()
              ,btn: "{:lang('Return')}"
              ,btnAlign: 'r' //按钮居中
              ,shade: 0 //不显示遮罩
              ,yes: function(){
                   var _form = $("#_form");
                   loading = layer.load(1,{shade:[0.1,'#fff']});
                   $.post(_this.data('href'),_form.serialize(),function(res){
                      layer.close(loading)
                      if(res.code == 1){
                          layer.msg(res.msg, {time: 1800, icon: 1},function(){
                            location.reload();
                          });
                      }else{
                          layer.msg(res.msg, {time: 1800, icon: 2});
                      }
                   })
              }
            });
          })
          /*确认删除*/
          $(".confirm-del").click(function(){
            var _this = $(this)
            var confirm = layer.confirm('{:lang("Is it sure to delete the line?")}',function(){
              layer.close(confirm);
                loading = layer.load(1,{shade:[0.1,'#fff']});
                $.post(_this.data('href'),{},function(res){
                    layer.close(loading)
                    if(res.code == 1){
                        layer.msg(res.msg, {time: 1800, icon: 1},function(){
                          location.reload();
                        });
                        
                    }else{
                        layer.msg(res.msg, {time: 1800, icon: 2});
                    }
                 })
            })
          })
          /*重置*/
          $("#_resetsn").click(function(){
              var _this= $(this);
             layer.open({
                type: 2 //此处以iframe举例
                ,title: "{:lang('Resetting the contract number')}"
                ,area: ['700px', '500px']
                ,shade: 0.8
                ,content: _this.data('href')
                ,zIndex: layer.zIndex //重点1
              })
          })
          /*显示输入密码狂*/
          $('.show-password').click(function(){
              var _this= $(this);
              if(_this.hasClass("layui-btn-disabled")){
                  return false;
              }
             var showodel = layer.open({
                type: 1//此处以iframe举例
                ,title: _this.text()
                ,area: ['400px', '200px']
                ,shade: 0.8
                ,btn: ["{:lang('Confirm')}"] //只是为了演示
                ,content: $("#enter-password").html()
                ,zIndex: layer.zIndex //重点1
                ,yes: function(){
                  loading = layer.load(1,{shade:[0.1,'#fff']});
                  $.post("{:U('ajax/checkPassword')}",{aid:_this.data('aid'),network_id:$("#pasw_nework_id").val(),password:$("#_password").val()},function(res){
                      layer.close(loading);
                      if(res.code == 1){
                           layer.close(showodel);
                          $(".access_id_"+res.data.aid).text(res.data.accessID)
                          $(".secrect_key_"+res.data.aid).text(res.data.secrectKey)
                          _this.addClass("layui-btn-disabled");
                      }else{
                        layer.msg(res.msg, {time: 1800, icon: 2});
                      }
                  })
                }
              })
          })
          /*分配工程师*/
          
          $('.fenpeiex').click(function(){
              var _this= $(this);
              if(_this.hasClass("layui-btn-disabled")){
                  return false;
              }
             var showodel = layer.open({
                type: 1//此处以iframe举例
                ,title: "{:lang('Distribution Engineer')}"
                ,area: ['400px', '300px']
                ,shade: 0.8
                ,btn: ["{:lang('Confirm')}"] //只是为了演示
                ,content: $("#fenpeiex_from").html()
                ,zIndex: layer.zIndex //重点1
                ,yes: function(){
                  loading = layer.load(1,{shade:[0.1,'#fff']});
                  $.post(_this.data('href'),$("#engine_form").serialize(),function(res){
                      layer.close(loading);
                      if(res.code == 1){
                          layer.msg(res.msg, {time: 1800, icon: 1},function(){
                            location.reload();
                          });
                           layer.close(showodel);
                          _this.addClass("layui-btn-disabled");
                      }else{
                        layer.msg(res.msg, {time: 1800, icon: 2});
                      }
                  })
                }
              })
             form.render('select')
          })
          /*工程师反馈*/
          $('.rebackcontent').click(function(){
              var _this= $(this);
              if(_this.hasClass("layui-btn-disabled")){
                  return false;
              }
              var _url = _this.data('href')
             var showodel = layer.open({
                type: 1//此处以iframe举例
                ,title: _this.text()
                ,area: ['400px', '250px']
                ,shade: 0.8
                ,btn: ["{:lang('Confirm')}"] //只是为了演示
                ,content: $("#reback_from_html").html()
                ,zIndex: layer.zIndex //重点1
                ,yes: function(){
                  loading = layer.load(1,{shade:[0.1,'#fff']});
                  $.post(_url,$("#reback_forms").serialize(),function(res){
                      layer.close(loading);
                      if(res.code == 1){
                           layer.msg(res.msg, {time: 1800, icon: 1},function(){
                            location.reload();
                           });
                          _this.addClass("layui-btn-disabled");
                      }else{
                        layer.msg(res.msg, {time: 1800, icon: 2});
                      }
                  })
                }
              })
             form.render()
          })
      })
   </script>
{/block}